/*
 * types.h
 *
 *  Created on: 2011/04/23
 *      Author: AKS
 */

#ifndef QUEUE_H_
#define QUEUE_H_

#include "types.h"

#define FIFO_BUF_SIZE 0x40
#define FIFO_BUF_MASK 0x3F

typedef struct t_FIFO_BUF
{
    BYTE buf[FIFO_BUF_SIZE];
    BYTE r_ptr;
    BYTE w_ptr;
} FIFO_BUF;

#define QUEUE_FILLED_LENGTH(r, w)  ((r>w) ? (FIFO_BUF_SIZE + w-r) : (w-r))

BOOL Enqueue(FIFO_BUF *buf, BYTE dat);
BOOL Dequeue(FIFO_BUF *buf, BYTE *dat);
BOOL Init_FIFO_Buffer(FIFO_BUF *buf);

#endif/*QUEUE_H_*/
